SET VER=02.00.00
SET COMPILE=RELEASE
ECHO OFF

if NOT x%1 == x""  set COMPILE=%1

REM delete the install directory for fresh files every time
del install /Q /F /S
echo Looking for any existing zip files - should be none
dir install\*.zip
md install
md install\resources
md install\resources\js
md install\resources\App_LocalResources
md install\resources\Images

SET PROD=iFinity.BlogFriendlyUrlProvider
set PRODVER=%PROD%_%VER%
set SRC=%PROD%
rem no trailing \ on the site variable.  The site variable specifies the root site path for the source website
rem where the developed code sits
set Site=d:\DotNetNuke\dnn561\website

ECHO ================== Start Copy %PROD% ====================================================
ECHO ON
rem copy the eula
copy %src%\package\*.* install\

REM Copy out of the bin directory, because all relevant dlls are in there
copy %SRC%\bin\%COMPILE%\ifinity.blog*.dll Install\
if "%COMPILE%" == "DEBUG" copy %SRC%\bin\%COMPILE%\ifinity.blog*.pdb Install\

REM Copy the relevant files out of the main directory
copy %SRC%\UI\*.dnn Install\
copy %SRC%\UI\*.ascx Install\Resources
copy %SRC%\UI\*.ashx Install\Resources
copy %SRC%\UI\images\*.* Install\Resources\images
copy %SRC%\UI\js\*.* Install\Resources\js
copy %SRC%\UI\*.css Install\Resources
copy %SRC%\UI\App_LocalResources\*.resx Install\Resources\App_LocalResources

REM copy the sql data provider files out of the data directory
copy %SRC%\Data\SqlDataProvider\*.SqlDataProvider Install\

ECHO OFF
ECHO ================== Finish Copy  %PROD% =======================


ECHO ================== Archive %PROD% ============================
ECHO ON

SET INSTALL_ZIP=%PROD%_%VER%_Install.zip
SET DEBUG_INSTALL_ZIP=%PROD%_%VER%_Debug_Install.zip
SET RESOURCES_ZIP=%PROD%_Resources.zip
SET ARCHIVE_ZIP=%PROD%_*_Install.zip

ECHO OFF
ECHO ================== Start Zipping %PROD% ======================
ECHO ON
rem zip up the resources file
rem puts it into the install directory
ECHO OFF
ECHO ================ Resources Files ============================
ECHO ON
CD install\resources
rem zip up all the resources into a single zip file and copy to /install path
"C:\program files\pkware\pkzipc.exe" -add -dir=current %RESOURCES_ZIP% *.* -excl=*.zip
move %RESOURCES_ZIP% ..\
CD ..\..

rem zip up the install file
ECHO OFF
ECHO ================ Install Files ========================================================
ECHO ON
if "%COMPILE%" == "RELEASE" "C:\program files\pkware\pkzipc.exe" -add Install\%INSTALL_ZIP% install\*.* -excl=%INSTALL_ZIP%
if "%COMPILE%" == "DEBUG" "C:\program files\pkware\pkzipc.exe" -add Install\%DEBUG_INSTALL_ZIP% install\*.* -excl=%DEBUG_INSTALL_ZIP%



rem zip up the source code
SET SOURCE_ZIP=%PROD%_%VER%_Source.zip

ECHO Deleting old source version
DEL %SOURCE_ZIP%

ECHO ================== Start Copying Source for %PROD% ====================================================
ECHO ON
REM Copy out of the bin directory, because all relevant dlls are in there
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% install\%install_ZIP% 

ECHO Copy SOlution Files
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% .\*.sln -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% .\deployToTestSite.bat -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% .\*.testrunconfig -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% .\readme.txt -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% .\bin\*.dll -dir=specify

ECHO Copy main project
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\*.csproj -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\*.cs -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\Data\SqlDataProvider\*.SqlDataProvider -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\Data\*.cs -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\Entities\*.cs -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\Package\*.* -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\*.ascx -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\*.ascx.cs -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\*.dnn -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\images\*.* -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\js\*.* -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\*.css -dir=specify
"C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\App_LocalResources\*.resx -dir=specify
REM "C:\program files\pkware\pkzipc.exe" -add %SOURCE_ZIP% %prod%\UI\App_LocalResources\*.cs -dir=specify

ECHO OFF


